package com.microservice.salmon.web.controller;

import com.microservice.salmon.service.category.CategoryService;
import com.salmon.common.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;
    /**
     * 获取平级的商品分类信息
     * @return
     */
    @GetMapping("/{categoryId:\\d+}")
    public ResponseEntity<ApiResponse> getChildrenParallelCategory(@PathVariable("categoryId") Integer categoryId){
        return ResponseEntity.ok(ApiResponse.ofSuccess(categoryService.getChildrenParallelCategory(categoryId)));
    }
}
